import { ReleaseType, Environment } from '@/api/version'

export const VERSION_VIEW_OPTIONS = [
  { label: '规划视图', value: 'plan' },
  { label: '工作项', value: 'work' },
  { label: '状态看板', value: 'kanban' },
  { label: '发布追踪', value: 'release' }
] as const

export const VERSION_KANBAN_DIMENSION_OPTIONS = [
  { label: '需求', value: 'requirement' },
  { label: '任务', value: 'task' },
  { label: '缺陷', value: 'defect' }
] as const

export const VERSION_RELEASE_TYPE_OPTIONS = [
  {
    label: '主版本',
    value: ReleaseType.MAJOR,
    description: '功能重构 / 重大改进'
  },
  {
    label: '次版本',
    value: ReleaseType.MINOR,
    description: '增量版本 / 新特性'
  },
  {
    label: '补丁',
    value: ReleaseType.PATCH,
    description: '缺陷修复 / 性能优化'
  },
  {
    label: '热修复',
    value: ReleaseType.HOTFIX,
    description: '紧急上线 / 生产修复'
  }
] as const

export const VERSION_ENVIRONMENT_OPTIONS = [
  {
    label: '开发环境',
    value: Environment.DEVELOPMENT,
    description: '日常开发联调环境'
  },
  {
    label: '测试环境',
    value: Environment.TESTING,
    description: '集中测试 / 验收环境'
  },
  {
    label: '预发布',
    value: Environment.STAGING,
    description: '灰度验证与演练'
  },
  {
    label: '生产',
    value: Environment.PRODUCTION,
    description: '正式对外发布环境'
  }
] as const

export type VersionViewKey = typeof VERSION_VIEW_OPTIONS[number]['value']
export type VersionKanbanDimension = typeof VERSION_KANBAN_DIMENSION_OPTIONS[number]['value']

export const DEFAULT_VERSION_VIEW: VersionViewKey = VERSION_VIEW_OPTIONS[0].value
export const DEFAULT_KANBAN_DIMENSION: VersionKanbanDimension =
  VERSION_KANBAN_DIMENSION_OPTIONS.find(option => option.value === 'task')?.value ??
  VERSION_KANBAN_DIMENSION_OPTIONS[0].value

